package org.com.coolfish.listener;


import org.com.coolfish.common.message.MsisdnCardMessage;
import org.com.coolfish.service.CMCCCardStopService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
@Component
@RabbitListener(queues = "cmcc-stop-queue")
public class CMCCMessageListener {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	private MsisdnCardMessage msisdnCardMessage;
	@Autowired
    private CMCCCardStopService cmccCardStopService;
    // 标识 不关联账户密钥表
 	

	@RabbitHandler
    public void onMessage(String message) {
		
		// 将String 转为MsisdnMessage对象
        logger.info("停机队列(cmcc-stop)获取数据[{}]", message);
        msisdnCardMessage = JSON.parseObject(message, MsisdnCardMessage.class);
        cmccCardStopService.handle(msisdnCardMessage);
        
	}
	
	
}
